<?php

/**
 * uniBoard ACP System BBCodes List
 *
 * Light and fast forum solution for web 2.0-like communities.
 *
 * @package		uniBoard
 * @author		Rafał Pitoń
 * @license		http://www.gnu.org/licenses/gpl-3.0.html
 * @since		Version 0.1
 * 
 * ------------------------------------------------------------------------
 * 
 * $Date: 2010-09-20 21:23:27 +0000 (Mon, 20 Sep 2010) $
 * $Revision: 64 $
 * $Author: rafio.xudb@gmail.com $
 */

// ------------------------------------------------------------------------

class action_bbcodes_sys{
	
	/**
	 * Main class pointer
	 *
	 * @var object
	 */
	
	private $appCore		= NULL;
	
	// ------------------------------------------------------------------------

	/**
	 * Initialise Action
	 *
	 * @param object $appCore
	 */
	
	function __construct( $appCore){
		
		// Store appCore pointer
		$this -> appCore = $appCore;
		
		// Cache output
		ob_start();
		
		// Open table block
		echo $appCore -> output -> openTableBlock();
		
		// Draw header
		echo $appCore -> output -> tableHeader( array(
			array(
				'left_float width_half',
				$appCore -> lang['acp_bbcodes_list_name']
			),
			array(
				'left_float width_quarter',
				$appCore -> lang['acp_bbcodes_list_code']
			)
		));
		
		// Select System BBCodes
		$appCore -> db -> query( 'SELECT bbcode_id, bbcode_system, bbcode_in_editor, bbcode_name, bbcode_tag
		FROM ' . DB_PREFIX . 'bbcodes
		WHERE bbcode_system = \'1\'');
		
		// Parse result
		while ( $bbcode_result = $appCore -> db -> fetch_array())
		{
			// Draw row
			echo $appCore -> output -> tableRow('
				<div class="cell left_float width_half">
					<b>' . $this -> appCore -> ifString( $bbcode_result[3]) . '</b>
				</div>
				<div class="cell left_border left_float width_quarter">
					<b>' . htmlspecialchars( $bbcode_result[4]) . '</b>
				</div>');
		}
		
		// Free result
		$appCore -> db -> freeResult();
		
		// Close table block
		echo $appCore -> output -> closeTableBlock();
		
		// Draw output
		$appCore -> output -> draw( $appCore -> lang['acp_bbcodes_system'], array( $appCore -> adminLink( 'act=bbcodes_sys') => $appCore -> lang['acp_bbcodes_system']), ob_get_clean());
				
	}

}